Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickTime Components /
Chapter 3 - Standard Image-Compression Dialog Components / Standard Image-Compression Dialog Components Reference
Application-Defined Function /


MyHook

This function is called by the standard dialog component whenever the user selects an item in the standard image-compression dialog box. You define the function in your application and assign it to a dialog box with the hookProc field of the scExtendedProcsType request, which is discussed on page 3-21.

This is how you would define a hook function called MyHook:

pascal short MyHook (DialogPtr theDialog, short itemHit,
                     void *params, long refcon);
theDialog
Contains a pointer to the dialog structure that identifies the current
dialog box.
itemHit
Identifies the item clicked by the user.
params
Contains a pointer to a field that contains the identifier for your connection to the standard dialog component. You can use this identifier to call the dialog component's SCGetInfo or SCSetInfo functions.
refcon
Contains the reference constant value you supplied to the SCGetCompressionExtended function.
DESCRIPTION
Your hook function returns a short integer that identifies the item selected by the user. In general, your hook function should return the same item number it receives in the itemHit parameter. By returning a specific value, you can affect how the component handles the user selection. The following values are defined:

scOKItem
Indicates that the user clicked the OK button.
scCancelItem
Indicates that the user clicked the Cancel button.
scCustomItem
Indicates that the user clicked the custom button.
If you set the returned value to 0, you cancel the user selection; the dialog box remains on the screen awaiting further action by the user.

The hook function allows your application to tailor or extend the operation of the standard image-compression dialog box. By attaching your hook function to the dialog box, you intercept all user selections. For example, your hook function could perform additional parameter checking whenever the user clicks the OK button. In this case, whenever you detect an incorrect parameter value, you could display a message to the user and then set the returned value to 0, thereby canceling the user's selection. The user would then either cancel the dialog box or try again.

As another example, you could support additional parameters by implementing
the dialog box's custom button. You could use your hook function to display a secondary dialog box whenever the user clicks the custom button. For an example of defining and using a custom button, see "Extending the Basic Dialog Box" beginning on page 3-11.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help